package org.budo.tencent.api;

import org.budo.support.http.client.HttpUtil;
import org.budo.support.http.client.Response;
import org.budo.tencent.response.UserInfoResponse;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lmw
 */
@Slf4j
public class TencentUserApi extends AbstractTencentApi {
    public UserInfoResponse getUserInfo(String accessToken, String openId) {
        String url = "https://graph.qq.com/user/get_user_info" //
                + "?oauth_consumer_key=" + this.getAppKey()//
                + "&access_token=" + accessToken //
                + "&openid=" + openId //
                + "&format=json";

        Response response = HttpUtil.get(url);

        log.info("#23 get_user_info, response=" + response);
        return new UserInfoResponse(response);
    }
}